Today, hash functions are widely used in a variety of computing applications to map data in a larger set to a value in a smaller set. For example, a relatively long sequence of bits may be supplied as an input into a mathematical function to generate a shorter sequence of bits that serves as an index into a database table.
One area of application in which hashing can be particularly useful is network switching. In general, a network switch may receive and transmit data packets via multiple ports. In some situations, there may be more than one possible network link via which a packet can be transmitted to properly forward the data packet to its destination. Moreover, network links sometimes are purposefully aggregated to provide more bandwidth between communicating devices or networks. Grouping links together to define wider communication channels is sometimes referred to as link aggregation (LAG). In those situations where multiple links present equally attractive routing choices to a network switch, the routing technique is typically referred to as equal-cost multi-path (ECMP) routing. A hash function is sometimes used to select one of the links in a LAG group to transmit a packet. For example, the hash function can be applied to a portion or portions of a header of the packet, and a result of the hash function indicates one of the links in the LAG group.